package com.yuanfeng.business.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yuanfeng.commoms.dto.shop.ShopPercentDTO;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * 店铺评分表
 * @TableName shop_evaluation
 */
@TableName(value ="shop_evaluation")
@Data
public class ShopEvaluationEntity implements Serializable {
    /**
     * 评价id
     */
    @TableId(type = IdType.AUTO)
    private Integer evaluationId;

    /**
     * 店铺ID
     */
    private Integer shopId;

    /**
     * 买家id
     */
    private String userId;

    /**
     * 订单ID
     */
    private String orderId;

    /**
     * 描述相符评分
     */
    private Integer evaluationDesccredit;

    /**
     * 服务态度评分
     */
    private Integer evaluationServicecredit;

    /**
     * 发货速度评分
     */
    private Integer evaluationDeliverycredit;

    /**
     * 评价时间
     */
    private Date evaluationCreateTime;

    @TableField(exist = false)
    private ShopPercentDTO shopPercent;// 店铺百分比

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        ShopEvaluationEntity other = (ShopEvaluationEntity) that;
        return (this.getEvaluationId() == null ? other.getEvaluationId() == null : this.getEvaluationId().equals(other.getEvaluationId()))
            && (this.getShopId() == null ? other.getShopId() == null : this.getShopId().equals(other.getShopId()))
            && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
            && (this.getOrderId() == null ? other.getOrderId() == null : this.getOrderId().equals(other.getOrderId()))
            && (this.getEvaluationDesccredit() == null ? other.getEvaluationDesccredit() == null : this.getEvaluationDesccredit().equals(other.getEvaluationDesccredit()))
            && (this.getEvaluationServicecredit() == null ? other.getEvaluationServicecredit() == null : this.getEvaluationServicecredit().equals(other.getEvaluationServicecredit()))
            && (this.getEvaluationDeliverycredit() == null ? other.getEvaluationDeliverycredit() == null : this.getEvaluationDeliverycredit().equals(other.getEvaluationDeliverycredit()))
            && (this.getEvaluationCreateTime() == null ? other.getEvaluationCreateTime() == null : this.getEvaluationCreateTime().equals(other.getEvaluationCreateTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getEvaluationId() == null) ? 0 : getEvaluationId().hashCode());
        result = prime * result + ((getShopId() == null) ? 0 : getShopId().hashCode());
        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
        result = prime * result + ((getOrderId() == null) ? 0 : getOrderId().hashCode());
        result = prime * result + ((getEvaluationDesccredit() == null) ? 0 : getEvaluationDesccredit().hashCode());
        result = prime * result + ((getEvaluationServicecredit() == null) ? 0 : getEvaluationServicecredit().hashCode());
        result = prime * result + ((getEvaluationDeliverycredit() == null) ? 0 : getEvaluationDeliverycredit().hashCode());
        result = prime * result + ((getEvaluationCreateTime() == null) ? 0 : getEvaluationCreateTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", evaluationId=").append(evaluationId);
        sb.append(", shopId=").append(shopId);
        sb.append(", userId=").append(userId);
        sb.append(", orderId=").append(orderId);
        sb.append(", evaluationDesccredit=").append(evaluationDesccredit);
        sb.append(", evaluationServicecredit=").append(evaluationServicecredit);
        sb.append(", evaluationDeliverycredit=").append(evaluationDeliverycredit);
        sb.append(", evaluationCreateTime=").append(evaluationCreateTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}